home *** CD-ROM | disk | FTP | other *** search
- unit Cfmpfun;
-
- interface
-
- uses
- SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
- Forms, Dialogs, StdCtrls, ExtCtrls, Buttons, UfMgr17;
-
- type
- TCCFMPropsForm = class(TForm)
- Panel1: TPanel;
- CheckBox1: TCheckBox;
- CheckBox2: TCheckBox;
- CheckBox3: TCheckBox;
- Bevel1: TBevel;
- Bevel2: TBevel;
- CheckBox4: TCheckBox;
- CheckBox5: TCheckBox;
- CheckBox6: TCheckBox;
- Panel3: TPanel;
- Label1: TLabel;
- Panel2: TPanel;
- BitBtn1: TBitBtn;
- BitBtn2: TBitBtn;
- BitBtn3: TBitBtn;
- BitBtn4: TBitBtn;
- procedure CheckBox4Click(Sender: TObject);
- procedure CheckBox5Click(Sender: TObject);
- procedure BitBtn4Click(Sender: TObject);
- procedure BitBtn2Click(Sender: TObject);
- procedure BitBtn1Click(Sender: TObject);
- procedure CheckBox6Click(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- WorkingFileName : String;
- IsADir ,
- IsAnArchive ,
- IsAVolumeID,
- IsAReadOnlyFile,
- IsAHiddenFile ,
- IsASystemFile : Boolean;
- ThePosition : Integer;
- TheGlobalForm : TCCFileMgrForm;
- procedure Initialize;
- end;
-
- var
- CCFMPropsForm: TCCFMPropsForm;
- implementation
-
- uses DRWSUtl3;
-
- {$R *.DFM}
-
- procedure TCCFMPropsForm.Initialize;
- begin
- Label1.Caption := ExtractFileName( WorkingFileName );
- CCFileMgrForm.ScrollBox1.TheFWB.GetFileAttributes( WorkingFileName , IsADir ,
- IsAnArchive , IsAVolumeId , IsAHiddenFile , IsAReadOnlyFile ,
- IsASystemFile );
- if IsAVolumeId then
- begin { VolumeID }
- CheckBox1.Checked := false;
- CheckBox2.Checked := false;
- CheckBox3.Checked := false;
- CheckBox4.Checked := false;
- CheckBox5.Checked := true;
- Checkbox6.Checked := false;
- BitBtn1.Enabled := false;
- BitBtn2.Enabled := false;
- end
- else
- begin { Files/Dirs }
- if IsADir then
- begin { Directory }
- if IsASystemFile then CheckBox1.Checked := true else
- CheckBox1.checked := false;;
- If IsAHiddenFile then CheckBox2.Checked := true else
- CheckBox2.checked := false;
- if IsAReadOnlyFile then CheckBox3.Checked := true else
- CheckBox3.checked := false;
- CheckBox4.Checked := true;
- CheckBox5.Checked := false;
- if IsAnArchive then Checkbox6.Checked := true else
- CheckBox6.Checked := false;
- BitBtn1.Enabled := true;
- BitBtn2.Enabled := true;
- end
- else
- begin { File }
- if IsASystemFile then CheckBox1.Checked := true else
- CheckBox1.checked := false;;
- If IsAHiddenFile then CheckBox2.Checked := true else
- CheckBox2.checked := false;
- if IsAReadOnlyFile then CheckBox3.Checked := true else
- CheckBox3.checked := false;
- CheckBox4.Checked := false;
- CheckBox5.Checked := false;
- Checkbox6.Checked := true;
- BitBtn1.Enabled := true;
- BitBtn2.Enabled := true;
- end;
- end;
- end;
-
- { Delphi wrote this; use it to make sure a directory stays a directory! }
- procedure TCCFMPropsForm.CheckBox4Click(Sender: TObject);
- begin
- { Ignore any user actions on this box }
- if IsADir then CheckBox4.Checked := true else CheckBox4.Checked := false;
- end;
-
- { Delphi wrote this; use it to make sure a volume label stays a volume label! }
- procedure TCCFMPropsForm.CheckBox5Click(Sender: TObject);
- begin
- { Ignore any user actions on this box }
- if IsAVolumeID then CheckBox5.Checked := true else CheckBox5.Checked := false;
- end;
-
- { Delphi wrote this; use it to get the next selected file, if any }
- procedure TCCFMPropsForm.BitBtn4Click(Sender: TObject);
- var CurrentName , { Holds work name}
- TheOldString : String; { Holds Dir }
- finished : Boolean; { Loop control }
- WorkingDir : String; { Holds mod wd }
- TheFile : File; { Generic file v }
- begin
- { Get current directory for later }
- GetDir( 0 , WorkingDir );
- { Check for need to add trailing \ }
- if WorkingDir[ Length( WorkingDir )] <> '\' then
- WorkingDir := WorkingDir + '\';
- { Use Generic file getting routine }
- CurrentName := TheGlobalForm.ScrollBox1.GetNextSelection( WorkingDir ,
- ThePosition );
- { if no next file invalidate next button }
- if Currentname = '' then BitBtn4.Enabled := false
- else
- begin { otherwise set up new name }
- WorkingFileName := CurrentName;
- { Reset display }
- Initialize;
- { show it }
- Invalidate;
- end;
- end;
-
- { Delphi wrote this; use it to clear any user inputs }
- procedure TCCFMPropsForm.BitBtn2Click(Sender: TObject);
- begin
- { reload file props }
- Initialize;
- { Show results }
- Invalidate;
- end;
-
- { Delphi wrote this; use it to set the properties of a file from cb's }
- procedure TCCFMPropsForm.BitBtn1Click(Sender: TObject);
- var TheAttributes : Integer; { holds attr settings }
- begin
- { Take no action on a volume ID }
- if IsAVolumeID then exit;
- { Set a directory's values; can be archive, sys, hid, ro }
- if IsADir then
- begin
- TheAttributes := faDirectory;
- if CheckBox6.Checked then TheAttributes := TheAttributes or faArchive;
- if CheckBox1.Checked then TheAttributes := TheAttributes or faSysFile;
- if CheckBox2.Checked then TheAttributes := TheAttributes or faHidden;
- if CheckBox3.Checked then TheAttributes := TheAttributes or faReadOnly;
- end
- else
- begin { Set a file's values, can be sys, hid , ro }
- TheAttributes := faArchive;
- if CheckBox1.Checked then TheAttributes := TheAttributes or faSysFile;
- if CheckBox2.Checked then TheAttributes := TheAttributes or faHidden;
- if CheckBox3.Checked then TheAttributes := TheAttributes or faReadOnly;
- end;
- if IsADir then
- begin
- { Set the props via call into FWB }
- TheGlobalForm.ScrollBox1.TheFWB.SetFileAttributes( WorkingFileName ,
- TheAttributes );
- end
- else
- begin
- { Set the props via call into FWB }
- TheGlobalForm.ScrollBox1.TheFWB.SetFileAttributes( WorkingFileName ,
- TheAttributes );
- end;
- { Reset display }
- Initialize;
- { And show it }
- Invalidate;
- end;
-
- { Delphi wrote this; use it to make sure a non-directory stays one! }
- procedure TCCFMPropsForm.CheckBox6Click(Sender: TObject);
- begin
- { Ignore any user actions on this box if not a directory }
- if not IsADir then Checkbox6.Checked := true;
- end;
-
- end.
-